how to solve inserting a node into a sorted doubly linked list hackerrank